package pub.cleangao.codegen.enquiry;

import lombok.Data;

@Data
public class ColumnInfo {

    /**
     * 数据库字段名
     */
    private String columnName;

    /**
     * 数据库类型
     */
    private String type;

    /**
     * 是否自增
     */
    private Boolean isIdentity;

    /**
     * 是否主键
     */
    private Boolean isPk;

    /**
     * 字段注释
     */
    private String comment;

    /**
     * 字段长度
     */
    private Integer maxLength;

    /**
     * 小数位长度
     */
    private Integer scale;

    /**
     * 字段是否允许为null
     */
    private Boolean isNullable = false;


    public String getFieldType() {
        return getColumnTypeConverter().javaType(type);
    }

    public String getFieldTypeBox() {
        return getColumnTypeConverter().javaTypeBox(getType());
    }


    public ColumnTypeConverter getColumnTypeConverter() {
        throw new UnsupportedOperationException("uncovered pub.cleangao.codegen.enquiry.ColumnInfo.getColumnTypeConverter()");
    }


    public Boolean getIsIdentity() {
        return isIdentity;
    }

    public Boolean getIsPk() {
        return isPk;
    }

    public Boolean getIsNullable() {
        return isNullable;
    }
}
